package org.tech4j.edi.common.entity;


import org.tech4j.edi.common.enums.RetryModelEnum;

import java.util.Date;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;

/**
 * @program: tech4j
 * @description:
 * @author: YuKai Fan
 * @create: 2025/3/7 09:57
 **/
public class RetryBizConfig {
    /**
     * 主键
     */
    private String id;

    /**
     * 业务类型
     */
    private String bizType;

    /**
     * 业务名称
     */
    private String bizName;

    /**
     * 最大重试次数。0表示不重试，-1无限重试
     */
    private Integer maxRetryTimes;

    /**
     * 执行间隔，毫秒为单位
     */
    private Integer retryInterval;

    /**
     * 0系统自动重试 1手动重试
     */
    private RetryModelEnum retryModel;

    /**
     * 切换次数
     */
    private Integer hourOverTimes;

    /**
     * 扩展字段
     */
    private Map<String, String> extraField;

    /**
     * 执行时长，单位秒
     */
    private Integer runDuration;

    private Boolean enabled;

    private String env;

    /**
     * 创建时间
     */
    private Date createdTime;

    /**
     * 修改时间
     */
    private Date modifiedTime;

    /**
     * 备注
     */
    private String remark;

    /**
     * 版本号
     */
    private Integer version;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getBizType() {
        return bizType;
    }

    public void setBizType(String bizType) {
        this.bizType = bizType;
    }

    public String getBizName() {
        return bizName;
    }

    public void setBizName(String bizName) {
        this.bizName = bizName;
    }

    public Integer getMaxRetryTimes() {
        return maxRetryTimes;
    }

    public void setMaxRetryTimes(Integer maxRetryTimes) {
        this.maxRetryTimes = maxRetryTimes;
    }

    public Integer getRetryInterval() {
        return retryInterval;
    }

    public void setRetryInterval(Integer retryInterval) {
        this.retryInterval = retryInterval;
    }

    public RetryModelEnum getRetryModel() {
        return retryModel;
    }

    public void setRetryModel(RetryModelEnum retryModel) {
        this.retryModel = retryModel;
    }

    public Map<String, String> getExtraField() {
        return extraField;
    }

    public void setExtraField(Map<String, String> extraField) {
        this.extraField = extraField;
    }

    public Integer getHourOverTimes() {
        return Optional.ofNullable(hourOverTimes).orElse(0);
    }

    public void setHourOverTimes(Integer hourOverTimes) {
        this.hourOverTimes = hourOverTimes;
    }

    public Integer getRunDuration() {
        return runDuration;
    }

    public void setRunDuration(Integer runDuration) {
        this.runDuration = runDuration;
    }

    public Boolean getEnabled() {
        return enabled;
    }

    public void setEnabled(Boolean enabled) {
        this.enabled = enabled;
    }

    public String getEnv() {
        return env;
    }

    public void setEnv(String env) {
        this.env = env;
    }

    public Date getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(Date createdTime) {
        this.createdTime = createdTime;
    }

    public Date getModifiedTime() {
        return modifiedTime;
    }

    public void setModifiedTime(Date modifiedTime) {
        this.modifiedTime = modifiedTime;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }
}
